package com.pureut.quality.controller;

import com.pureut.common.core.web.controller.BaseController;
import com.pureut.common.core.web.domain.AjaxResult;
import com.pureut.quality.domain.vo.QualitySchemeConfigurationVo;
import com.pureut.quality.domain.vo.QualityTemporaryVo;
import com.pureut.quality.service.QualityTemporaryService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/***
 *
 * Author:C
 * Date:2023/02/06 16:06
 * @DESC
 */
@RestController
@RequestMapping("/quality-temporary")
public class QualityTemporaryController extends BaseController {

    @Resource
    QualityTemporaryService qualityTemporaryService;


    /**
     * 根据检验单号获取物料号码
     */
    @GetMapping("/getMaterialNumber")
    public AjaxResult getMaterialNumber(String inspectionSheetNo, String batchNo) {
        return AjaxResult.success(qualityTemporaryService.getMaterialNumber(inspectionSheetNo, batchNo));
    }

    /**
     * 获取条数(检验进度总条数)
     */
    @GetMapping("/getTotalSize")
    public int getTotalSize(QualitySchemeConfigurationVo qualitySchemeConfigurationVo) {
        return qualityTemporaryService.getTotalSize(qualitySchemeConfigurationVo);
    }

    /**
     * 获取列表
     */
    @GetMapping("/list")
    public AjaxResult getList(String inspectionSheetNo) {
        return AjaxResult.success(qualityTemporaryService.getList(inspectionSheetNo));
    }

    /**
     * 物料新增接口（feign调用）
     */
    @PostMapping("/materialAdd")
    public AjaxResult materialAdd(@RequestBody QualityTemporaryVo qualityTemporaryVo) {
        return toAjax(qualityTemporaryService.materialAdd(qualityTemporaryVo));
    }

    /**
     * 查询品检信息（feign调用 追溯管理页面使用）
     */
    @GetMapping("/getQualityTemporaryList")
    public AjaxResult getQualityTemporaryList(String wsiMaterialNumber) {
        return AjaxResult.success(qualityTemporaryService.getQualityTemporaryList(wsiMaterialNumber));
    }

    /**
     * 查询巡检信息（feign调用 追溯管理页面使用）
     */
    @GetMapping("/getPatrolTemporaryList")
    public AjaxResult getPatrolTemporaryList(String wsiMaterialNumber) {
        return AjaxResult.success(qualityTemporaryService.getPatrolTemporaryList(wsiMaterialNumber));
    }


}
